<?php
 defined("BASEDIR") or die();
 
 class Application_Model_SessionControl
 {
	protected static $instance;
	protected $params = array();
	
	protected function __construct()
	{
		$this->params = $_SESSION;
	}
	public function __destruct()
	{
		$_SESSION = $this->params;
	}
	public function __get($var)
	{
		return $this->params[$var];
	}
	public function __set($var, $val)
	{
		$this->params[$var] = $val;
	}
	public static function getInstance()
	{
		if(!self::$instance instanceof self)
			self::$instance = new self;
		return self::$instance;
	}
	public function destroy()
	{
		session_destroy();
		unset($this->params);
	}
 }
?>